package it.vetlab;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HtmlServlet extends HttpServlet {

	private static final String HTML_SUFFIX = ".html";

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String htmlUri = req.getRequestURI();
		String jspUri = htmlUri.substring(0, htmlUri.length()
				- HTML_SUFFIX.length())
				+ ".jsp";
		req.getRequestDispatcher(jspUri).forward(req, resp);
	}

}
